#-----------List--------------
#creat
a = ['a', 'b', 'e', 'f']
c = ['c', 'd']
b = c + a
print(b)
print(a*10)

#append
a.append('x')
print(a)

#insert
a.insert(0,'z')
print(a)

#retrieve
print(a[0:2])
print(a[:1])
print(a[-1])

d = list(range(30))
print(d)
print(d[1:15:3])

print(b.index('d'))

acd = ['a', 'd', 'k', 'j']
acd.insert(acd.index('k'), 'q')
print(acd)

#Update
acd[1:3] = "ai"
print('替换后的元素：', acd)

#delete
acd.pop()
print(acd)
acd.remove('a')
print(acd)

#统计和排序
print(acd.count('a'))
acd.reverse()
print(acd)
print(list(reversed(acd)))

l = [3, 6, 2, 0, 9]
l.sort()
print(l)

#-----------Tuple--------------
#retrieve
t = ('a', 'b', 'z', 'k')
print(t[0])
print(t[1:3])
print(t.index('k'))

#-----------Dict--------------
#creat
d_t = {'a': 1}
d_t['c'] = 2
print(d_t)

d_t1 = {'k': 3}
d_t.update(d_t1)
print(d_t)

d_t.setdefault("z", 5)
print(d_t)
print(d_t['k'])
print(d_t.get('a', 0))

print(d_t.keys())
print(d_t.values())
print(d_t.items())

#update
d_t['a'] = 16
print(d_t)

d_t.update({'w': 12, 'a': 66})
print(d_t)

#delete
d_t.pop('a')
print(d_t)
d_t.popitem()
print(d_t)
d_t.clear()
print(d_t)

#-----------Set--------------
#creat
s_t = set()
s_t.add(1)
s_t.add(2)
print(s_t)

#retrieve
print(1 in s_t)

#update
s_t.update({2, 3, 5})
print(s_t)

s_t1 = (6, 7 ,0, 3)
s_t2 = s_t.union(s_t1)
print(s_t2)
#delete
s_t.remove(2)
print(s_t)
s_t.remove(5)
print(s_t)

s_t.pop()
print(s_t)

#-----------------------------------------------------------------------------------
#        |        creat               delete               update         retrieve

#List              ✔                    ✔                    ✔               ✔

#Tuple             ✘                     ✘                     ✘               ✔

#Dict             ✔                     ✔                     ✔              ✔

#Set              ✔                     ✔                     ✔              ✘

